﻿using System.Linq;
using NUnit.Framework;
using SPFluid.Modularity;
using SPFluid.ServiceLocation;

namespace SPFluid.Test.ServiceLocation
{
    [TestFixture]
    public class SPFluidServiceLocatorTest : SPTestBase
    {
        protected override string SiteUrl
        {
            get
            {
                return "http://moss2010";
            }
        }

        protected override string WebUrl
        {
            get
            {
                return "/";
            }
        }

        [Test]
        public void GetAllModules()
        {
            this.UsingSite(
                site =>
                {
                    var serviceLocator = FluidServiceLocator.GetCurrent(site);
                    var modules = serviceLocator.GetAllInstances<IModule>();

                    Assert.IsNotNull(modules);
                    Assert.IsTrue(modules.Count() >= 0);
                });
        }
    }
}